﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using NCS.Module.CMS.Library;
using NCS.Library.Utilities;
using NCS.Module.CMS.Library.Definitions;
using NCS.Library;
using NCS.Module.CMS.Library.Distributions;
using NCS.Library.Components.Partner;
using NCS.Module.CMS.Library.Events;
using NCS.Module.CMS.Library.Zones;
namespace NCS.Module.CMS.Web.Movies
{
    public partial class LeftEvent : CMSWebControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            int catid = ConvertUtility.ToInt32(Request.QueryString["catid"]);
            if (catid != 0)
            {
                Advertisement1.Param = "catid";
            }
            
            if(AppEnv.GetLanguage() == "vi-VN")
            {
                hplCaption.Text = "Sự kiện";
            }
            else
            {
                hplCaption.Text = "Event";
            }

            hplCaption.NavigateUrl = BuildUrlbyEvent();
            hplMore.NavigateUrl = BuildUrlbyEvent();

            DataTable left = EventController.GetAllByNum(4);
            rptEvent.DataSource = left;
            rptEvent.DataBind();

        }


        protected void rptEvent_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemIndex < 0) return;
            DataRowView currow = (DataRowView)e.Item.DataItem;
            Image imgPic = (Image)e.Item.FindControl("imgPic");
            imgPic.ImageUrl = ConvertUtility.ToString(currow["Event_Avatar"]) != string.Empty ? MultimediaUtility.GetEventAvatar(currow["Event_Avatar"].ToString()) : "";
            if (imgPic.ImageUrl == "") imgPic.Visible = false;

            HyperLink hplTitle = (HyperLink)e.Item.FindControl("hplTitle");

            //string tooltip = MiscUtility.ToolTip(ConvertUtility.ToString(currow["Event_Name"]), ConvertUtility.ToString(currow["Event_Avatar"]), ConvertUtility.ToString(currow["Event_Description"]), "", ConvertUtility.ToDateTime(currow["Event_CreateDate"]));
            //hplTitle.Attributes.Add("onmouseover", "showtip('" + tooltip + "','322','#f1f1f1')");
            //hplTitle.Attributes.Add("onmouseout", "hidetip()");

            hplTitle.NavigateUrl = BuildUrlbyEvent((int)currow["Event_ID"]);
        }
    }
}